class_name ControllerComponent_SteeringBehavior
extends ControllerComponent

#region 属性
@export var behaviors:Array[BaseContextBehavior]
var behavior_dict:Dictionary[GameEnum.ContextBehaviorType,BaseContextBehavior] = {}
#endregion
#region 字段
var steering_behavior_agent:SteeringBehaviorAgent:
	get:
		return %SteeringBehaviorAgent
#endregion
#region 信号
#endregion

#region 基类方法
func init_component(args:Dictionary = {}):
	super(args)
	for behavior in behaviors:
		if not behavior_dict.has(behavior.behavior_type):
			behavior_dict.set(behavior.behavior_type,behavior)
	control_all_behaviors(false)
	steering_behavior_agent.update_behaviors(self,behaviors)
#endregion
#region 公共方法
func get_steering_behavior_agent() -> SteeringBehaviorAgent:
	return steering_behavior_agent
## 操控所有的behavior
func control_all_behaviors(enable:bool):
	for behavior_type in behavior_dict.keys():
		control_behavior_by_type(behavior_type,enable)
## 操控指定类型的behavior
func control_behavior_by_type(behavior_type:GameEnum.ContextBehaviorType,enable:bool):
	var behavior:BaseContextBehavior = behavior_dict.get(behavior_type)
	if behavior:
		behavior.enable = enable
#endregion
#region 私有方法
#endregion
#region 生命周期函数
#endregion
